<%@ page contentType="text/html;charset=UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<c:set var="ctx" value="${pageContext.request.contextPath}" />

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8"> 
  <meta name="”renderer”" content="”webkit”"> 
  <meta http-equiv="”X-UA-Compatible”" content="”IE=Edge,chrome=1″"> 
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> 
  <title>乐直播-直播间</title> 
  <link rel="stylesheet" href="http://cdn.lezhibo.com/staticRep/layui/css/layui.css?cdnv=0.16"> 
  <link rel="stylesheet" href="http://cdn.lezhibo.com/static/portal/css/le-main24.css?cdnv=0.16"> 
  <link rel="stylesheet" href="http://cdn.lezhibo.com/static/libs/font-awesome/css/font-awesome.min.css?cdnv=0.16"> 
  <style type="text/css">
.le-ar-image{
/*display:table;width: 60px;
height: 60px;
overflow: hidden;
margin: 0 auto;
border: 1px solid #eee;
*/}
.le-ar-img{/*display: table-cell;vertical-align: middle;*/}
.le-account-portrait img{width: 60px;height: 60px;}
        </style> 
  <script src="http://cdn.lezhibo.com/static/portal/js/fastclick.js?cdnv=0.16"></script> 
 </head> 
 <body> 
  <div class="le-main"> 
   <div class="le-head"> 
    <div class="le-head-content"> 
     <div class="le-head-logo">
      <a href="#"><img src="http://cdn.lezhibo.com/static/portal/img/lelive-logo4.jpg"></a>
     </div> 
     <div class="le-head-nav"> 
      <ul class="layui-nav le-nav"> 
       <li class="layui-nav-item" id="nav-index"><a href="/portal">直播活动</a></li> 
       <li class="layui-nav-item" id="nav-videoClip"><a href="/videoClip/portal">小视频</a></li> 
       <li class="layui-nav-item" id="nav-mcloud"><a href="/portal/mediacloud">媒体云</a></li> 
       <li class="layui-nav-item" id="nav-shop"><a href="/portal/shop">商城</a></li> 
       <li class="layui-nav-item" id="nav-device"><a href="/portal/device">硬件设备</a></li> 
       <li class="layui-nav-item" id="nav-liveroom"><a href="/portal/liveroom/info?id=d9c6afa2e0b649afbd56d3c10e6ffc3d">直播间</a></li> 
       <li class="layui-nav-item" id="nav-alliance"><a href="/portal/publish">联盟市场</a></li> 
      </ul> 
     </div> 
     <div class="le-head-personal"> 
      <ul class="le-head-icon"> 
       <li class="le-head-icon-bell"> <a href="/portal/center/message"> <i class="fa fa-bell fa-lg" aria-hidden="true"></i> </a> <span class="bell-mark"><i class="fa fa-circle" aria-hidden="true"></i></span> </li> 
       <!--
                        <li><a href=""><i class="fa fa-server fa-lg" aria-hidden="true"></i></a></li>
                        --> 
       <li><a href="/portal/center"> <img src="http://cdn.lezhibo.com/static/portal/images/avatar.jpg"> </a></li> 
      </ul> 
     </div> 
    </div> 
   </div> 
  </div> 
  <div class="le-content-wrap le-head-content"> 
   <div class="le-sidebar"> 
    <ul class="layui-nav layui-nav-tree"> 
     <li class="layui-nav-item" id="info"><a href="/portal/liveroom/info?id=d9c6afa2e0b649afbd56d3c10e6ffc3d"><i class="fa fa-cog" aria-hidden="true"></i>&nbsp;基础设置</a></li> 
     <li class="layui-nav-item" id="recommend"><a href="/portal/liveroom/recommend?id=d9c6afa2e0b649afbd56d3c10e6ffc3d"><i class="fa fa-share" aria-hidden="true"></i>&nbsp;推荐设置</a></li> 
     <li class="layui-nav-item" id="selfTemplate"><a href="/portal/liveroom/selfTemplate?id=d9c6afa2e0b649afbd56d3c10e6ffc3d"><i class="fa fa-comment-o" aria-hidden="true"></i>&nbsp;发送模板消息</a></li> 
     <li class="layui-nav-item" id="preview"><a href="/portal/liveroom/preview?id=d9c6afa2e0b649afbd56d3c10e6ffc3d"><i class="fa fa-caret-square-o-right" aria-hidden="true"></i>&nbsp;直播间预览</a></li> 
     <li class="layui-nav-item" id="vip"><a href="/portal/liveroom/vip?id=d9c6afa2e0b649afbd56d3c10e6ffc3d"><i class="fa fa-diamond" aria-hidden="true"></i>&nbsp;VIP设置</a></li> 
     <li class="layui-nav-item" id="userDuration"><a href="/portal/liveroom/vipUserDeadline?id=d9c6afa2e0b649afbd56d3c10e6ffc3d"><i class="fa fa-list-alt" aria-hidden="true"></i>&nbsp;VIP会员列表</a></li> 
     <li class="layui-nav-item" id="auth"><a href="/portal/liveroom/vipAuthRecord?id=d9c6afa2e0b649afbd56d3c10e6ffc3d"><i class="fa fa-th-list" aria-hidden="true"></i>&nbsp;VIP认证记录</a></li> 
     <li class="layui-nav-item" id="vipCombo"><a href="/portal/liveroom/vipCombo?id=d9c6afa2e0b649afbd56d3c10e6ffc3d"><i class="fa fa-list" aria-hidden="true"></i>&nbsp;VIP套餐管理</a></li> 
     <li class="layui-nav-item" id="mobile"><a href="/portal/liveroom/mobileAuthVip?id=d9c6afa2e0b649afbd56d3c10e6ffc3d"><i class="fa fa-phone" aria-hidden="true"></i>&nbsp;VIP手机管理</a></li> 
     <li class="layui-nav-item" id="card"><a href="/portal/liveroom/cardAuthVip?id=d9c6afa2e0b649afbd56d3c10e6ffc3d"><i class="fa fa-id-card" aria-hidden="true"></i>&nbsp;VIP卡号管理</a></li> 
     <li class="layui-nav-item" id="manager"><a href="/portal/liveroom/manager?id=d9c6afa2e0b649afbd56d3c10e6ffc3d"><i class="fa fa-id-card" aria-hidden="true"></i>&nbsp;管理员设置</a></li> 
     <li class="layui-nav-item" id="portal"><a href="/portal/liveroom/portal?id=d9c6afa2e0b649afbd56d3c10e6ffc3d"><i class="fa fa-home" aria-hidden="true"></i>&nbsp;直播间门户</a></li> 
     <li class="layui-nav-item" id="portalView"><a href="/portal/liveroom/portalView?id=d9c6afa2e0b649afbd56d3c10e6ffc3d"><i class="fa fa-caret-square-o-right" aria-hidden="true"></i>&nbsp;门户预览</a></li> 
     <li class="layui-nav-item" id="category"><a href="/portal/liveroom/category?id=d9c6afa2e0b649afbd56d3c10e6ffc3d"><i class="fa fa-home" aria-hidden="true"></i>&nbsp;活动分类</a></li> 
    </ul> 
   </div> 
   <div class="le-content"> 
    <div class="" style="text-align:center;"> 
     <img src="http://cdn.lezhibo.com/static/portal/images/category.jpg" style="display:none;"> 
    </div> 
    <div class="le-account-addbtn" style="text-align:center;"> 
     <button layer-func="reloadPage()" class="layui-btn" layer-href="/portal/liveroom/addCategory?id=d9c6afa2e0b649afbd56d3c10e6ffc3d">添加</button> 
    </div> 
    <table class="le-mall-table"> 
     <tbody>
      <tr class="le-table-title"> 
       <th>分类名称</th> 
       <th>分类简介</th> 
       <th>微信端分类名称</th> 
       <th>微信端分类简介</th> 
       <th>分类图标</th> 
       <th>操作</th> 
      </tr> 
      <tr> 
       <td> H </td> 
       <td> H </td> 
       <td> H </td> 
       <td> H </td> 
       <td class="le-account-portrait"> <img src="http://cdn.lezhibo.com/static/portal/icon/0.png"> </td> 
       <td> <button class="layui-btn layui-btn-primary layui-btn-small" confirm-href="/portal/liveroom/deleteActivityCategory?activityCategoryId=5ddb2f178f8c48c5a82c809157e9793b">删除</button> <button class="layui-btn layui-btn-primary layui-btn-small" layer-func="reloadPage()" layer-href="/portal/liveroom/_editCategory?id=d9c6afa2e0b649afbd56d3c10e6ffc3d&amp;activityCategoryId=5ddb2f178f8c48c5a82c809157e9793b">编辑</button> </td> 
      </tr> 
     </tbody>
    </table> 
    <div class="le-pages"> 
     <a href="javascript:;" class="previous disabled">上一页</a> 
     <a href="javascript:;" class="active">1</a> 
     <a href="javascript:;" class="next disabled">下一页</a> 
    </div> 
    <div class="clearfix"></div> 
    <div class="le-footer"> 
     <p>Copyright © 2015-2017 www.lezhibo.com All rights reserved.</p> 
    </div> 
   </div> 
  </div> 
  <script type="text/javascript" src="http://cdn.lezhibo.com/staticRep/layui/layui.js?cdnv=0.16"></script> 
  <script type="text/javascript" src="http://cdn.lezhibo.com/staticRep/layui/lay/dest/layui.all.js?cdnv=0.16"></script> 
  <script type="text/javascript" src="http://cdn.lezhibo.com/static/libs/jquery/jquery.min.js?cdnv=0.16"></script> 
  <script type="text/javascript" src="http://cdn.lezhibo.com/static/libs/jquery/jquery.form.min.js?cdnv=0.16"></script> 
  <script>
            var cdnPath="http://cdn.lezhibo.com";//cdn路径
            function fix() {
                var head_height = $('.le-head').outerHeight();
                var window_height = $(window).height();
                var content_height = $('.le-content').outerHeight();
                var sidebar_height = $(".le-sidebar").height();
                var max_height = window_height - head_height;
                if(content_height < sidebar_height){
                    content_height = sidebar_height;
                }

                if(max_height < content_height){
                    max_height = content_height;
                }

                $(".le-content").css('min-height', max_height);
                $(".le-sidebar").css('min-height', max_height);


//                if (content_height < (window_height - head_height)) {
//                    $(".le-content").css('min-height', window_height - head_height);
//                } else {
//                    $(".le-sidebar").css('min-height', content_height);
//                    sidebar_height = content_height;
//                }
//
//                if (sidebar_height < (window_height - head_height)) {
//                    $(".le-sidebar").css('min-height', window_height - head_height);
//                }
            }

            var globalNeedRefreshIndex = "";
            var globalNeedRefreshUrl = "";
            var needRefresh = false;

            function openLayer(url, title, func, isNeedRefreshThisPage) {
                var index = layer.open({
                    type: 2,
                    title: title,
                    shadeClose: true,
                    shade: 0.6,
                    area: ['60%', '80%'],
                    content: url,
                    end: function () {
                        if (needRefresh) {
                            layer.iframeSrc(globalNeedRefreshIndex, globalNeedRefreshUrl);//刷新第几层
                            needRefresh = false;
                        }

                        if (!(typeof(func) == "undefined")) {
                            eval(func);
                        }
                    }
                });

                if (isNeedRefreshThisPage == true) {
                    globalNeedRefreshIndex = index;
                    globalNeedRefreshUrl = url;
                }

            }

            function layerInit() {
                $("[layer-href]").click(function () {
                    if ("" == $(this).attr("layer-need-record")) {
                        openLayer($(this).attr("layer-href"), $(this).attr("layer-title"), $(this).attr("layer-func"), true);
                    } else {
                        openLayer($(this).attr("layer-href"), $(this).attr("layer-title"), $(this).attr("layer-func"), false);
                    }
                });

                $("[go-href]").click(function () {
                    var href = $(this).attr("go-href");
                    var newWind = $(this).attr("go-href-new");
                    if (newWind == "true") {
                        window.open(href);
                    } else {
                        window.location.href = href;
                    }
                });


                $("[confirm-href]").click(function () {
                    var href = $(this).attr("confirm-href");
                    if ((typeof(href) == "undefined") || href == null || href == "") {
                        return;
                    }

                    var title = $(this).attr("confirm-title");
                    if ((typeof(title) == "undefined") || title == null || title == "") {
                        title = "您确定执行该操作吗？"
                    }
                    layer.confirm(title, {icon: 9, title: '确定操作 ？'}, function (index) {
                                layer.close(index);
                                $.get(href, function (result) {
                                    if (result.isOk) {
                                        location.reload();
                                    } else {
                                        alert(result.message);
                                    }
                                });
                            },
                            function (index) {
                                layer.close(index);
                            });
                });


            }

            function headerFocus() {
                $("#nav-liveroom").addClass("layui-this");
            }


            function initSidebarUrls() {

                $(".le-sidebar").find(".layui-nav-item").each(function () {
                    var pid = $(this).attr("id");
                    if (typeof(pid) == 'undefined' || null == pid) {
                        return;
                    }

                    var href = $(this).children('a').attr("href");
                    if ((typeof(href) != "undefined") && href.indexOf("?") == -1) {
                        href = href + "?p=" + pid;
                    } else {
                        href = href + "&p=" + pid;
                    }
                    $(this).attr("class", "layui-nav-item");
                    $(this).children('a').attr("href", href);
                });

                $("#category").attr("class", "layui-nav-item layui-this");
            }

            var verification = {
                mobiel: function () {
                    $mobile = $("input[validate='mobile']").val();
                    var re = /^1\d{10}$/;
                    if ((typeof($mobile) != "undefined") && !re.test($mobile)) {
                        $("input[validate='mobile']").after('<p class="le-tips"><span style="color: red;width: 100%">请输入正确的手机号</span></p>');
                        return false;
                    }
                },
                email: function () {
                    $email = $("input[validate='email']").val();
                    var re = /^(\w-*\.*)+@(\w-?)+(\.\w{2,})+$/;
                    if ((typeof($email) != "undefined") && !re.test($email)) {
                        $("input[validate='email']").after('<p class="le-tips"><span style="color: red;width: 100%">请输入正确的邮箱</span></p>');
                        return false;
                    }
                },
                empty: function () {
                    var $input = $("input[validate='empty']");
                    for (var i = 0; i < $input.length; i++) {
                        if ($input.eq(i).val().trim().length == 0) {
                            $("input[validate='empty']").eq(i).after('<p class="le-tips"><span style="color: red;width: 100%">输入不能为空</span></p>');
                            return false;
                        }
                    }

                    var $textarea =$("textarea[validate='empty']");
                    for(var i=0;i<$textarea.length;i++){
                        if($textarea.eq(i).val().trim().length==0){
                            $("textarea[validate='empty']").eq(i).after('<p class="le-tips"><span style="color: red;width: 100%">输入不能为空</span></p>');
                            return false;
                        }
                    }
                },

                password: function () {
                    $password = $("input[validate='password']").val();
                    var re = /(.+){6,12}$/;
                    if ((typeof($password) != "undefined") && !re.test($password)) {
                        $("input[validate='password']").after('<p class="le-tips"><span style="color: red;width: 100%">请输入6到12位密码</span></p>');
                        return false;
                    }
                },
                //正整数
                positiveInteger: function () {
                    $positiveInteger = $("input[validate='positiveInteger']");
                    var re=/^[1-9]\d*|0$/;
                    for (var i = 0; i < $positiveInteger.length; i++) {
                        var every=$positiveInteger.eq(i).val().trim();
                        if ((typeof(every) != "undefined") && !re.test(every)) {
                            $("input[validate='positiveInteger']").eq(i).after('<p class="le-tips"><span style="color: red">请输入一个正整数或者0</span></p>');
                            return false;
                        }
                    }
                },
                decimal: function (value) {
                   $decimal = $("input[validate='decimal']");
                    var re = /^[0-9]+\.{0,1}[0-9]{0,2}$/;
                    for (var i = 0; i < $decimal.length; i++) {
                        var every=$decimal.eq(i).val().trim();
                        if ((typeof(every) != "undefined") && !re.test(every)) {
                            $("input[validate='decimal']").eq(i).after('<p class="le-tips"><span style="color: red">值不能小于0</span></p>');
                            return false;
                        }
                    }
                }
            };


            var regularVerify = {
                mobile: function (value) {
                    var re = /^1\d{10}$/;
                    if ((typeof(value) != "undefined") && !re.test(value)) {
                        return false;
                    }
                },
                email: function (value) {
                    var re = /^(\w-*\.*)+@(\w-?)+(\.\w{2,})+$/;
                    if ((typeof(value) != "undefined") && !re.test(value)) {
                        return false;
                    }
                },
                password: function (value) {
                    var re = /(.+){6,12}$/;
                    if ((typeof(value) != "undefined") && !re.test(value)) {
                        return false;
                    }
                },
                integer: function (value)     {
//                    var re = /^[1-9]\d*$/;
                    var re = /^\d+$/;
                    if ((typeof(value) != "undefined") && !re.test(value)) {
                        return false;
                    }
                },
                decimal: function (value) {
//                    var re = /^[1-9]\d*\.\d*|0\.\d*[1-9]\d*$/;
                    var re = /^[0-9]+\.{0,1}[0-9]{0,2}$/;
                    if ((typeof(value) != "undefined") && !re.test(value)) {
                        return false;
                    }
                },
                empty: function (value) {
                    if (value.trim().length == 0) {
                        return false;
                    }
                }
            }


            function leSubmit() {
                $("[le-submit]").click(function () {
                    var $form = $(this).parents("form");
                    var sfunc = $form.attr("success-func");
                    var bfunc = $form.attr("before-func");
                    $form.ajaxSubmit({
                        type: "post",
                        dataType: "json",
                        beforeSend: function () {
                            if(bfunc != null){
                                if(false == eval(bfunc)){
                                    return false;
                                }
                            }
                            $(".le-tips").remove();
                            if (false == verification.empty()) {
                                return false;
                            }
                            if (false == verification.mobiel()) {
                                return false;
                            }
                            if (false == verification.email()) {
                                return false;
                            }
                            if (false == verification.password()) {
                                return false;
                            }
                        },
                        success: function (result) {
                            if (sfunc != null) {
                                eval(sfunc);
                                return;
                            }

                            if (result.isOk) {
                                parent.isUpdateData = true;
                                parent.layer.closeAll();
                            } else {
                                alert(result.message);
                            }
                        },
                        error: function () {
                            alert("信息提交错误");
                        }
                    });
                })
            }

            //对日期选择范围的控制
            //对id为begin-date和end-date的日期选择控件进行控制
            function verifyDate() {
                layui.use('laydate', function () {
                    var laydate = layui.laydate;
                    var start = {
                        min: '2006-01-01 00:00:00',
                        max: '2099-06-16 23:59:59',
                        istoday: false,
                        choose: function (datas) {
                            end.min = datas;    //开始日选好后， 重置结束日的最小日期
                            end.start = datas;  //将结束日的初始值设定为开始日
                        }
                    };

                    var end = {
                        min: '2006-01-01 00:00:00',
                        max: '2099-06-16 23:59:59',
                        istoday: false,
                        choose: function (datas) {
                            start.max = datas;  //结束日选好后, 重置开始日的最大日期
                        }
                    };

                    $('.begin-date').click(function () {
                        start.elem = this;
                        laydate(start);
                    });
                    $('.end-date').click(function () {
                        end.elem = this;
                        laydate(end);
                    });

                });
            }

            fix();
            layerInit();
            headerFocus();
            initSidebarUrls();
            leSubmit();
            verifyDate();


//<script>
    var isUpdateData = false;
    function reloadPage(){
        if(isUpdateData){
            isUpdateData = false;
            location.reload();
        }
    }

    //</script>    
 </body>
</html>